home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-08-16 | 2.4 KB | 72 lines | [TEXT/MPS ] |
- #-------------------------------------------------------------------------------
- # DeleteMakes
- # MPW Shell Script
- # Written by Gina Cherry • August 16, 1991
- # Copyright: © 1991 by Apple Computer, Inc., all rights reserved.
- #
- # Usage:
- # DeleteMakes [directory]
- #
- # Function:
- # DeleteMakes generates commands to delete all files named 'Makefile' or ending with '.make'. DeleteMakes
- # operates on a directory specified on the command line and all of its subdirectories. If no directory is
- # specified, DeleteMakes operates on the current directory. DeleteMakes generates the delete commands
- # to a file called DeleteMakes.out, which is opened at the end of this script. DeleteMakes.out can be executed
- # to delete the Makefiles.
- #-------------------------------------------------------------------------------
-
- # Make sure no more than one parameter was specified.
- If {#} > 1
- Echo "### Usage: {0} [directory]"
- Exit 1
- End
-
- # If a parameter was specified, set {dir} to the parameter; otherwise, set {dir} to the current directory.
- If {#} == 1
- Set dir "{1}"
- Else
- Set dir `Directory`
- End
-
- # Don't exit on error.
- Set Exit 0
-
- # If the specified directory does not exist, write error message and exit script.
- If !`Exists -d "{dir}" ≥ Dev:Null`
- Echo "### {0}: Directory {dir} not found"
- Exit 2
- End
-
- # Delete old versions of DeleteMakes.out
- Close -n {0}.out ≥ Dev:Null
- Delete -y {0}.out ≥ Dev:Null
-
- # Get a list of all directories contained in the specified directory.
- Set directories "`files "{dir}" -r -f -d -o`"
- # Add the specified directory to the beginning of the list of directories.
- Set directories "'{dir}' {directories}"
-
- # Loop through the list of directories.
- For directory in {directories}
- # Echo the name of the current directory to the output file.
- Echo "# {directory}" >> {0}.out
- # Loop through the '.make' files in the current directory, generating a delete command for each.
- For file in `Files -f -s "{directory}"≈.make`
- Echo -n "Delete -y " >> {0}.out
- Echo "{file}" >> {0}.out
- End
- # Loop through the 'Makefile' files in the current directory, generating a delete command for each.
- For file in `Files -f -s "{directory}"Makefile ≥ Dev:Null`
- Echo -n "Delete -y " >> {0}.out
- Echo "{file}" >> {0}.out
- End
- Echo >> {0}.out
- End ≥ Dev:Null
-
- # Open the output file which contains the delete commands.
- Open {0}.out
-
-
-
-
-